From 2df06d3490c3e0b6acbce25d16ef61e693fc2d8c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 21 Jul 2014 19:49:11 -0400 Subject: [PATCH] GtkWidgetPath: Show states in the path string This shows clearly that some widgets don't set the state on their path currently. --- gtk/gtkwidgetpath.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/gtk/gtkwidgetpath.c b/gtk/gtkwidgetpath.c index 40d29721e0..ba94a7fb2e 100644 --- a/gtk/gtkwidgetpath.c +++ b/gtk/gtkwidgetpath.c @@ -22,6 +22,7 @@ #include "gtkwidget.h" #include "gtkwidgetpath.h" #include "gtkstylecontextprivate.h" +#include "gtktypebuiltins.h" /** * SECTION:gtkwidgetpath @@ -327,6 +328,28 @@ gtk_widget_path_to_string (const GtkWidgetPath *path) g_string_append_c (string, ')'); } + if (elem->state) + { + GFlagsClass *fclass; + gint i; + gboolean appended; + + appended = FALSE; + fclass = g_type_class_ref (GTK_TYPE_STATE_FLAGS); + g_string_append_c (string, '['); + for (i = 0; i < fclass->n_values; i++) + { + if (elem->state & fclass->values[i].value) + { + if (appended) + g_string_append_c (string, '|'); + g_string_append (string, fclass->values[i].value_nick); + appended = TRUE; + } + } + g_string_append_c (string, ']'); + g_type_class_unref (fclass); + } if (elem->siblings) g_string_append_printf (string, "[%d/%d]", -- 2.30.2